package leetcode.code0349;

import leetcode.IDebug;

public class Solution implements IDebug {

	public int[] intersection(int[] nums1, int[] nums2) {
		Boolean[] bucket = new Boolean[1001];
		for (int num : nums1) {
			if (bucket[num] == null) {
				bucket[num] = false;
			}
		}
		int size = 0;
		for (int num : nums2) {
			if (bucket[num] != null && !bucket[num]) {
				bucket[num] = true;
				size++;
			}
		}
		int[] ans = new int[size];
		int p = 0;
		for (int i = 0; i < 1001; i++) {
			if (bucket[i] != null && bucket[i]) {
				ans[p++] = i;
			}
		}
		return ans;
	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
